<template>
  <view class="rich-container">
    <rich-text :nodes="content"></rich-text>
  </view>
</template>

<script>
export default {
  data() {
    return {
      title: '',
      content: ''
    };
  },
  onLoad(options) {
    if (options.title) {
      this.title = decodeURIComponent(options.title);
      uni.setNavigationBarTitle({ title: this.title });
    }
    if (options.content) {
      try {
        this.content = JSON.parse(decodeURIComponent(options.content));
      } catch (e) {
        this.content = options.content;
      }
    }
  }
};
</script>

<style>
.rich-container {
  padding: 20rpx;
  background-color: #fff;
  min-height: 100vh;
}
.title {
  font-size: 32rpx;
  font-weight: bold;
  margin-bottom: 20rpx;
}

/* 富文本容器 */
.rich-container ::v-deep p {
  text-align: center; /* 居中 */
  margin: 0;
  padding: 0;
}

.rich-container ::v-deep img {
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
  display: block;
  margin: 0 auto;
}
</style>